'use strict';
module.exports = {
	/**
	 * 获取所有的会员类型
	 * @url admin/common/sys/getVipRoles 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
		let { uid } = data;
		let res = { code: 0, msg: "" };
		// 业务逻辑开始-----------------------------------------------------------

		let role_data = await vk.baseDao.findByWhereJson({
			dbName: "dictionary-table",
			whereJson: { dictionary_id: "vip-roles" }
		})
		if (!role_data.number)
			res.data = []
		//分割处理
		res.data = role_data.number.split(',').map(v => {
			let item = v.split('|')
			return {
				value: item[1] || 'error',
				label: item[0] || 'error'
			}
		})

		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
